/*****************************************************************************
 * plum_type.h
 *
 * Copyright (C) 2020 Jeasonvor <1101627719@qq.com>
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 *
 ****************************************************************************/

#ifndef __PLUM_TYPE_H__
#define __PLUM_TYPE_H__

/*****************************************************************************
 * Included Files
 ****************************************************************************/

/*****************************************************************************
 * Pre-processor Definitions
 ****************************************************************************/

/*****************************************************************************
 * Public Types
 ****************************************************************************/

#if defined(__CC_ARM) /* for MDK */
typedef unsigned char      plum_u8;
typedef signed char        plum_s8;
typedef unsigned short     plum_u16;
typedef signed short       plum_s16;
typedef unsigned int       plum_u32;
typedef signed int         plum_s32;
typedef unsigned long long plum_u64;
typedef signed long long   plum_s64;
typedef float              plum_float;
typedef double             plum_double;
typedef enum { plum_false, plum_true } plum_bit;
typedef void plum_void;
#elif defined(__GNUC__)   /* for Linux */
typedef unsigned char      plum_u8;
typedef char               plum_s8;
typedef unsigned short     plum_u16;
typedef short              plum_s16;
typedef unsigned int       plum_u32;
typedef int                plum_s32;
typedef unsigned long long plum_u64;
typedef long long          plum_s64;
typedef float              plum_float;
typedef double             plum_doule;
typedef enum { plum_false, plum_true } plum_bit;
typedef void plum_void;
#elif defined(__ICCARM__) /* for IAR */
typedef unsigned char      plum_u8;
typedef signed char        plum_s8;
typedef unsigned short     plum_u16;
typedef signed short       plum_s16;
typedef unsigned int       plum_u32;
typedef signed int         plum_s32;
typedef unsigned long long plum_u64;
typedef signed long long   plum_s64;
typedef float              plum_float;
typedef double             plum_doule;
typedef void               plum_void;
typedef enum { plum_false, plum_true } plum_bit;
#endif

/* 函数宏 */
#if defined(__CC_ARM)
#define PLUM_ASM           __asm
#define PLUM_INLINE        __inline
#define PLUM_STATIC_INLINE static __inline
#define PLUM_USED          __attribute__((used))
#define PLUM_WEAK          __attribute__((weak))
#define PLUM_ALIGNED(x)    __attribute__((aligned(x)))
#define PLUM_PACKED        __attribute__((packed))
#define PLUM_RESTRICT      __restrict

#elif defined(__ICCARM__)

#elif defined(__GNUC__)
#define PLUM_ASM           __asm
#define PLUM_INLINE        inline
#define PLUM_STATIC_INLINE static inline
#define PLUM_USED          __attribute__((used))
#define PLUM_WEAK          __attribute__((weak))
#define PLUM_ALIGNED(x)    __attribute__((aligned(x)))
#define PLUM_PACKED        __attribute__((packed, aligned(1)))
#define PLUM_RESTRICT      __restrict

#else
#error "Unkonwn compiler"
#endif

#define plum_null    (plum_void *)0
#define PLUM_PRIVATE static
#define PLUM_CONST   const
#define PLUM_PUBLIC
#define __PLUM_I__
#define __PLUM_O__
#define __PLUM_IO__

/*****************************************************************************
 * Public Data
 ****************************************************************************/

/****************************************************************************/
#ifdef __cplusplus
extern "C" {
#endif
/*****************************************************************************
 * Public Function Prototypes
 ****************************************************************************/

/****************************************************************************/
#ifdef __cplusplus
}
#endif
/****************************************************************************/
#endif /* __PLUM_TYPE_H__ */
/****************************************************************************/

/****************************************************************************/
/*                                                                          */
/*  End of file.                                                            */
/*                                                                          */
/****************************************************************************/
